package command

import (
	"fmt"
	"probe/internal/logger"

	"github.com/spf13/cobra"
)

var (
	InstallCmd = &cobra.Command{
		Use:   "install",
		Short: "install",
		Long:  `install.`,
		Run: func(cmd *cobra.Command, args []string) {
			installService(args)
		},
	}
)

func installService(args []string) {
	err := SRV.Install()
	if err != nil {
		fmt.Printf("Failed to install %v,error:%v\n", Name, err)
		logger.Errorf("Failed to install %v,error:%v\n", Name, err)
		return
	} else {
		logger.Infof("Succeed to install service %v\n", Name)
		fmt.Printf("Succeed to install service %v\n", Name)
	}

}
